package com.example.zgdemo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.zgdemo.bean.TSeckillStock;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
public interface StockMapper extends BaseMapper<TSeckillStock> {
    @Select("update t_seckill_stock set stock = stock-#{count} where id = #{id} and stock>=#{count}")
    int updateStock(@Param("id") Long id, @Param("count") int count);
}
